package com.teacher.controller;

import com.teacher.entity.EvaluationCriterion;
import com.teacher.service.EvaluationCriterionService;
import com.teacher.untils.ResultEntity;
import com.teacher.untils.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "评价标准信息管理")
@RequestMapping("/evaluationCriterion")
@RestController
public class EvaluationCriterionController {
    @Autowired
    private EvaluationCriterionService evaluationCriterionService;

    // 增加
    @ApiOperation("评价标准信息增加")
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultEntity  addEvaluationCriterion(@RequestBody EvaluationCriterion evaluationCriterion){
        return ResultUtils.build(evaluationCriterionService.addEvaluationCriterion(evaluationCriterion));
    }

    // 修改
    @ApiOperation("评价标准信息修改")
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public ResultEntity updateEvaluationCriterion(@RequestBody EvaluationCriterion evaluationCriterion){
        return ResultUtils.build(evaluationCriterionService.updateEvaluationCriterion(evaluationCriterion));
    }

    // 根据id查看详情
    @ApiOperation("评价标准信息查看详情")
    @GetMapping(value = "/getDetailsById/{id}")
    public ResultEntity getDetailsById(@PathVariable("id") String id){
        return ResultUtils.build(evaluationCriterionService.getDetailsById(id));
    }

    // 根据id删除
    @ApiOperation("评价标准信息删除")
    @DeleteMapping(value = "/delete/{id}")
    public void deleteEvaluationCriterion(@PathVariable("id") String id){
        evaluationCriterionService.deleteEvaluationCriterion(id);
    }

    // 根据id批量删除
    @ApiOperation("评价标准信息批量删除")
    @DeleteMapping("/batch")
    public void deleteEvaluationCriterionList(String idList){
        evaluationCriterionService.deleteEvaluationCriterionList(idList);
    }

    /*// 校级以下用户根据维度查看
    @ApiOperation("评价标准信息根据维度查看")
    @GetMapping(value = "/getDetailsByEcDimension/{ecDimension}")
    public ResultEntity getDetailsByEcDimension(@PathVariable("ecDimension") String ecDimension){
        return ResultUtils.build(evaluationCriterionService.getDetailsByEcDimension(ecDimension));
    }*/

    @ApiOperation("评价标准信息获取所有")
    @GetMapping(value = "/findAll")
    public ResultEntity<Object> findAll(){
        return ResultUtils.build(evaluationCriterionService.findAll());
    }

    // 根据条件分页查询
    @ApiOperation(value = "根据条件分页查询",notes = "根据条件分页查询")
    @GetMapping("/specificPage")
    public ResultEntity specificPageQueryEvaluationCriterionList(EvaluationCriterion evaluationCriterion,int page,int size){
        return ResultUtils.build(evaluationCriterionService.specificPageQueryEvaluationCriterionList(evaluationCriterion,page,size));
    }
}
